#include <asm.h>
#include <regdef.h>
#include <new_inst_test.h>

LEAF(my8_movn_test)
    .set noreorder
    addiu s0, s0 ,1
    addiu s2, zero, 0x0
    lui   t2, 0x1
###test inst

    Test_Rtype(movn,0x123,0x123,0xffffffff);
    Test_Rtype(movn,0x126,0x126,0x1);
    Test_Rtype(movn,0x1b0,0x1b0,0x1);
    Test_Rtype(movn,0xafe98c,0xafe98c,0x2d);
    Test_Rtype(movn,0x123,0x123,0x1);
    TEST_MOVN_TRUE(0x1312213,0x432452);
    TEST_MOVN_TRUE(0xfedc08,0xfffffe8);
    TEST_MOVN_TRUE(0xf3c2213,0x4e24d2);
    TEST_MOVN_TRUE(0x1332a1e,0x4924b8);
    TEST_MOVN_TRUE(0xc012e13,0xf92452);
    TEST_MOVN_TRUE(0xd38221f,0x432a52);

    LI (t0,0x123);
    LI (t1,0x2234);
    LI (t2,0);
    TEST_MOVN_FALSE(0x542314);
    TEST_MOVN_FALSE(0xe53b578);
    TEST_MOVN_FALSE(0xaafa386d);
    TEST_MOVN_FALSE(0x115090c);
    TEST_MOVN_FALSE(0xff0426);
    TEST_MOVN_FALSE(0x86a15d);
    TEST_MOVN_FALSE(0x555a45);




###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
test:
    beq s0,s3,inst_error
    nop
    addiu s3,s3,1
    j test
    nop
inst_error:
    sll t1, s0, 24
    or t0, t1, s3
    sw t0, 0(s1)
    jr ra
    nop
END(my8_movn_test)
